package com.example.fangyh09.fragment;

import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

/**
 * Created by fangyh09 on 8/12/2016.
 */
public class MyFragment5 extends Fragment {
    String code = "Thank you,Activity";
    public MyListener listener;
    public interface MyListener {
        public void thank(String str);
    }

    @Override
    public void onAttach(Context context) {
        listener = (MyListener)context;
        super.onAttach(context);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment,container,false);
        TextView text = (TextView)view.findViewById(R.id.text);
        String str = getArguments().get("name") + "";
        Toast.makeText(getActivity(),"success" ,Toast.LENGTH_SHORT).show();
        text.setText(str);
        //text.setText("static loading...");
        listener.thank(code);
        return view;
        //return super.onCreateView(inflater, container, savedInstanceState);
    }
}





